<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>13_案例练习-输入一个数组,返回数组中所有元素的和</title>
    </head>
    <body>
        <script>
            function f1(arr){
                var sum = 0;
                for(var i = 0; i < arr.length; i++){
                    sum += arr[i];
                }
                return sum;
            }

            var a = f1([1,2,3,4,5]);
            console.log(a);
        </script>
    </body>
</html>